home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11441 < prev    next >
Encoding:
Text File  |  1996-08-05  |  782 b   |  27 lines

  1. Path: andrew.cmu.edu!elie+
  2. From: Elie Jean-Philippe <elie+@andrew.cmu.edu>
  3. Newsgroups: comp.lang.c
  4. Subject: loading a new process using exec()
  5. Date: Sun, 24 Mar 1996 02:47:51 -0500
  6. Organization: Carnegie Mellon, Pittsburgh, PA
  7. Message-ID: <0lJDsb200iol07bUU0@andrew.cmu.edu>
  8. NNTP-Posting-Host: po7.andrew.cmu.edu
  9.  
  10. Hi all,
  11.  
  12. I'm trying to load a program in a new process created using fork(). 
  13. I'm using the following code (under HP-UX, 9.0):
  14.  
  15. char *cmd_args[]  = {"test",NULL};
  16. if (execl(cmd_args[0],cmd_args) < 0) {
  17. printf("error loading program, error # is: %d\n",errno);
  18. exit(-1);
  19. }
  20. where errno = 14 (bad address)
  21. It would seem that cmd_args is not correctly set or,  execl is not
  22. called correctly.
  23. Does anybody have some ideas about this ?
  24. Thanks in advance for any help.
  25.  
  26. Elie.
  27.